const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgUrls: [
      'https://images.unsplash.com/photo-1551334787-21e6bd3ab135?h=' + parseInt(320 * app.globalData.rpxToPxBl),
      'https://images.unsplash.com/photo-1551214012-84f95e060dee?h=' + parseInt(320 * app.globalData.rpxToPxBl),
      'https://images.unsplash.com/photo-1551446591-142875a901a1?h=' + parseInt(320 * app.globalData.rpxToPxBl),
    ],
    current: 0,
    allCommentsShowModal: false,
    maskShowModel: false,
    isScroll: false,
    commentsForShowModal: false, //评价谁的弹窗
    mask2ShowModel: false,
    shareModal: false,
    textareaNum: 0,
    scrollTop: 0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function (options) {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
  onPageScroll: function (e) {
    let that = this;
    that.setData({
      scrollTop: e.scrollTop
    })
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  swiperChange: function (e) {
    this.setData({
      current: e.detail.current
    })
  },
  back: function () {
    wx.navigateBack();
  },
  allCommentsShowModal: function () {
    this.setData({
      allCommentsShowModal: true,
      maskShowModel: true,
      isScroll: true
    })
  },
  hiddenModels: function () {
    this.setData({
      allCommentsShowModal: false,
      maskShowModel: false,
      isScroll: false,
      shareModal: false
    })
  },
  commentsFor: function (e) {
    this.setData({
      commentsForShowModal: true,
      mask2ShowModel: true
    })
  },
  hiddenModelsTwo: function () {
    this.setData({
      commentsForShowModal: false,
      mask2ShowModel: false
    })
  },
  comForChange: function (e) {
    console.log(e.detail.value.length)
    this.setData({
      textareaNum: e.detail.value.length
    })
  },
  showShareModal: function () {
    this.setData({
      shareModal: true,
      maskShowModel: true
    })
  },
  toBuy:function(){
    wx.navigateTo({
      url: '../goods-detail/goods-detail',
    })
  }
})